<div class="posts-manage-wrapper">
    <style>
        .posts-manage-wrapper div.posts-manage {  min-height: 400px  }
        .sort-btn {  padding: 5px;  }
        .sort-btn a {  display: inline-block;  color: #333;  font-weight: 500;  padding: 0 13px;  line-height: 34px;  border: 1px solid #999;  border-radius: 5px;  }
        /* 模态框css样式 */
        #mask{  background-color:#ccc;  opacity:0.5;  filter: alpha(opacity=50);  position:absolute;  left:0;  top:0;  z-index:1000;}
        #login{  position:fixed;  width: 650px; padding: 15px ;height: 500px; z-index:1001;  background: white;  border-radius: 15px;  overflow: auto;}
        #login .title {background-color: #00a0e9; color: white;}
        #login .content {margin-top: 15px;}
        .content img{max-width:100%;}
        .sanjiao-top {content: ' ';width: 0;  height: 0; position: absolute;left: 55px;top: 5px;border-style: solid;border-width: 0 5px 8.7px 5px; border-color: transparent transparent #000 transparent;  line-height: 0px;  _border-color: #000000 #000000 #ed212c #000000;  _filter: progid:DXImageTransform.Microsoft.Chroma(color='#000000');  }
        .sanjiao-bottom{content: ' ';width: 0;height: 0;position: absolute;left: 55px;bottom: 0;border-style: solid;border-width: 8.7px 5px 0 5px; border-color: #000 transparent transparent transparent; line-height: 0px; _border-color: #ed212c #000000 #000000 #000000;  _filter: progid:DXImageTransform.Microsoft.Chroma(color='#000000');  }
    </style>
    <div class="posts-manage">
        <div class='weui-panel bc-list weui-table' id='cashier-order-list' data-port='http://api.hongyanche.com/forum_admin/forum_list'>
            <input class="js-sort hidden" autocomplete='off' name='type' value='apply' checked type='radio' />
            <input class="hidden" autocomplete='off' name='page' value='' id="page" />
            <a href="javascript:void (0)" class="sanjiao weui-btn weui-btn_mini weui-btn_primary" dataid="apply">未审核</a>
            <a href="javascript:void (0)" class="sanjiao weui-btn weui-btn_mini weui-btn_primary" dataid="">已通过</a>
            <div class="weui-cell weui-cell_access ">
                <div class="weui-cell__bd"> <small>标签</small></div>
                <div class="weui-cell__bd"><small>标题</small></div>
                <div class="weui-cell__bd"><small class="">用户名</small></div>
                <div class="weui-cell__bd " style="position: relative"><small class="">回复量</small>
                    <a dataid="reply_amount_asc" href="javascript:void(0)" class="sanjiao sanjiao-top"></a>
                    <a dataid="reply_amount" href="javascript:void (0)" class="sanjiao sanjiao-bottom"></a>
                </div>
                <div class="weui-cell__bd " style="position: relative"><small class="">浏览量</small>
                    <a dataid="browse_asc" href="javascript:void(0)" class="sanjiao sanjiao-top"></a>
                    <a dataid="browse" href="javascript:void (0)" class="sanjiao sanjiao-bottom"></a>
                </div>
                <div class="weui-cell__bd"><small>板块</small></div>
                <div class="weui-cell__bd " style="position: relative"><small>发表时间</small>
                    <a dataid="create_time_asc" href="javascript:void(0)" class="sanjiao sanjiao-top"></a>
                    <a dataid="create_time" href="javascript:void (0)" class="sanjiao sanjiao-bottom"></a>
                </div>
                <div class="weui-cell__bd"><small>电话</small></div>
            </div>
            <small class='bc-list-content'></small>
            <div class='bc-list-template'>
                <div class='weui-cell weui-cell_access bc-modal-data js-article' data-toggle='modal' data-target='#cashier-refund'>
                    <div class='weui-cell__bd' style="min-width: 145px">
                        <tag list=1></tag>
                    </div>
                    <div class='weui-cell__bd' style="min-width: 145px; white-space:nowrap;text-overflow:ellipsis;-o-text-overflow:ellipsis;overflow: hidden;display: inline">
                        <title list=1 style="display: inline;"></title>
                    </div>
                    <div class='weui-cell__bd' style="min-width: 145px">
                        <user_name list=1></user_name>
                    </div>
                    <div class='weui-cell__bd' style="min-width: 145px">
                        <reply_amount list=1></reply_amount>
                    </div>
                    <div class='weui-cell__bd' style="min-width: 145px">
                        <browse list=1></browse>
                    </div>
                    <div class='weui-cell__bd' style="min-width: 145px">
                        <cn list=1></cn>
                    </div>

                    <div class='weui-cell__bd' style="min-width: 145px">
                        <create_time list=t></create_time>
                    </div>
                    <div class='weui-cell__bd' style="min-width: 145px">
                        <tel list=1></tel>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<sss>
    ;(function (w, u) {
        $('#cashier-order-list').on('bc-list-success', function () {
            $('.bc-list-loadmore').html(LIST.page);
        });
        // 模态框
        function openNew() {
            //获取页面的高度和宽度
            var sWidth=document.body.scrollWidth;
            var sHeight=document.body.scrollHeight;
            //获取页面的可视区域高度和宽度
            var wHeight=document.documentElement.clientHeight;
            var oMask=document.createElement("div");
            oMask.id="mask";
            oMask.style.height=sHeight+"px";
            oMask.style.width=sWidth+"px";
            document.body.appendChild(oMask);
            var oLogin=document.createElement("div");
            oLogin.id="login";
            oLogin.innerHTML="<div class='loginCon'><div id='close' style='position: absolute; right: 0; top: 0;'><i class='weui-icon weui-icon-cancel weui-icon-original' style='font-size: 25px;'></i></div></div>";
            document.body.appendChild(oLogin);
            //获取登陆框的宽和高
            var dHeight=oLogin.offsetHeight;
            var dWidth=oLogin.offsetWidth;
            //设置登陆框的left和top
            oLogin.style.left=sWidth/2-dWidth/2+"px";
            oLogin.style.top=wHeight/2-dHeight/2+"px";
            //点击关闭按钮
            var oClose=document.getElementById("close");
            //点击登陆框以外的区域也可以关闭登陆框
            oClose.onclick=oMask.onclick=function(){
                document.body.removeChild(oLogin);
                document.body.removeChild(oMask);
            };
        }

        // js-article
        $('#cashier-order-list').on('click', '.js-article', function () {
            var title = $(this).children().find('title').first().text();
            var content = $(this).children().find('content').html();
            var state = $(this).children().find('state').text();
            var forumID = $(this).children().find('forum_id').text();
            openNew();
            $.ajax({
                url:'http://api.hongyanche.com/forum/label_list',
                type:'POST',
                xhrFields:{
                withCredentials:true
                },
                success:function (data) {
                    if(data.state){
                        var datas = data.data.list;
                        var labels = '';
                        for (var i=0;i<datas.length;i++){
                            labels+="<option value=" + datas[i].label_id + ">" + datas[i].cn + "</option>";
                        }
                        $('#login').append(`
                    <div class="title"><h2>${title}</h2></div>
                    <div class="content">${content}</div>
                    <div class="modal-footer">
                        <div>
                         转移板块:
                         <select id="labels">
                             <option value="">当前板块</option>
                                ${labels}
                         </select>
                        </div>
                         <a href="javascript:void(0)" class="passed weui-btn weui-btn_mini weui-btn_primary">通过</a>
                         <a href="javascript:void(0)" class="rejected weui-btn weui-btn_mini weui-btn_primary">拒绝</a>
                    </div>
                `);
                    }
                }
            });

            if (state == 1) {
                $('.modal-footer').remove();
            }

            $('#login').on('click', '.passed', function () {
                var label_id = $('#labels').val();
                $.ajax({
                    url: 'http://api.hongyanche.com/forum_admin/apply_dispose/',
                    type: 'POST',
    xhrFields:{
    withCredentials:true
    },
                    data: {
                        forum_id: forumID,
                        approve: 1,
                        label_id:label_id
                    },
                    success: function (data) {
                        if(data.state){
                            alert('成功通过');
                            $('#login').remove();
                            $('#mask').remove();
                            LIST.reload('#cashier-order-list');
                        }else{
                            alert('失败')
                        }

                    },
                    error: function (err) {
                        alert('未通过');
                    }
                })
            });
            $('#login').on('click', '.rejected', function () {
                $(this).parent().parent().html(`
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <label class="weui-label">原因：</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input id="rejected-info" class="weui-input" type="text" placeholder="请输入拒绝的原因：">
                        </div>
                    </div>
                    <button class="submit weui-btn weui-btn_warn">提交</button>
                `);
            });

            $('#login').on('click', '.submit', function () {
                var rejectedInfo = $('#rejected-info').val();
                var label_id = $('#labels').val();
                $.ajax({
                    url:'http://api.hongyanche.com/forum_admin/apply_dispose',
                    type: 'POST',
    xhrFields:{
    withCredentials:true
    },
                    data: {
                        forum_id: forumID,
                        approve: 0,
                        reason: rejectedInfo,
                        label_id:label_id
                    },
                    success: function (data) {
                        if(data.state){
                            alert('成功');
                            $('#login').remove();
                            $('#mask').remove();
                            LIST.reload('#cashier-order-list');
                        }else{
                            alert('失败');
                            $('#login').remove();
                            $('#mask').remove();
                        }

                    },
                    error: function () {
                        alert('失败');
                        $('#login').remove();
                        $('#mask').remove();
                    }
                })
            })
        });

        // 按钮排序 升序
        $('.posts-manage').on('click', '.sanjiao', function () {
            var aID = $(this).attr('dataid');
            $('.js-sort').val(aID);
            $('#page').val(1);
            LIST.reload('#cashier-order-list');
        });
    })(window, undefined);
    // 分页按钮
    function ajax_page(num, e) {
    $('#page').val(num);
    LIST.reload('#cashier-order-list');
    }
</sss>